package com.karson.common.request;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.karson.common.constants.RegularConstants;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Tag(name="LoginAdminRequest对象", description="后台登录对象")
public class LoginAdminRequest implements Serializable {

    private static final long serialVersionUID=1L;

    @Schema( description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18888888")
    @NotBlank(message = "手机号不能为空")
    @Pattern(regexp = RegularConstants.PHONE_TWO, message = "手机号码格式错误")
    @JsonProperty(value = "account")
    private String account;

    @Schema(
            description = "密码",
            requiredMode = Schema.RequiredMode.REQUIRED,
            example = "123456",
            minLength = 6,  // 最小长度
            maxLength = 18  // 最大长度
    )
    @Pattern(regexp = RegularConstants.PASSWORD, message = "密码格式错误，密码必须以字母开头，长度在6~18之间，只能包含字符、数字和下划线")
    private String password;



}
